package com.example.back.controller;

import com.example.back.model.TCollection;
import com.example.back.service.TCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : 贾媛晴
 * @createTime : 2022/5/10 14:10
 */
@RestController
@Api(tags = "TCollectionController")
@CrossOrigin //允许跨域
public class TCollectionController {

    @Autowired
    TCollectionService tCollectionService;

    @ApiOperation("收藏")
    @GetMapping("/Show_Collection")
    public List<TCollection> selectCollection(String username) {
        List<TCollection> collectionList = this.tCollectionService.selectCollection(username);
        return collectionList;
    }

    @ApiOperation("加入收藏")
    @GetMapping("/insert_Collection")
    public int insertCollection(String username, String food, String areaname){
        return this.tCollectionService.insertCollection(username, food, areaname);
    }
}
